<!DOCTYPE html>
<html>
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <meta http-equiv="X-UA-Compatible" content="ie=edge">
    <title></title>
    <script src="https://cdn.jsdelivr.net/npm/vue/dist/vue.js"></script>
</head>
<body>
    <template id='sonTemp'>
        <div>
            <h3>{{item}}</h3>
            <button @click='sonChange'>修改</button>
        </div>
    </template>
    <script>
        const son={
            template:'#sonTemp',
            methods:{
                sonChange(){
                    this.$emit('change-item','这是子组件的数据')
                }
               
            },
            props:{
                item:String
            }

        }
    </script>
    <div id='app'>
        <son :item='fatherItem' @change-item='fatherChange'>

        </son>
    </div>
    <script>
    const vm = new Vue({
        el: '#app',
        data: {
            fatherItem:'父组件传参'
        },
        components:{
            son
        },
        methods:{
            fatherChange(e){
                this.fatherItem=e
            }
        }
    })
    </script>
</body>
</html>